#!/system/bin/sh
LOCK_FILE="$(dirname "$0")/widget_daemon.pid"
if [ -f "$LOCK_FILE" ]; then
    pid=$(cat "$LOCK_FILE")
    if [ -n "$pid" ] && [ -d "/proc/$pid" ]; then
        exit 1
    fi
    rm -f "$LOCK_FILE"
fi
echo $$ > "$LOCK_FILE"
trap 'rm -f "$LOCK_FILE"' EXIT
echo root >/dev/null 2>/dev/null || exit 2
renice -n -20 $$
while true; do
    am broadcast -a android.appwidget.action.APPWIDGET_UPDATE -p com.linuxrm.countdown.gaokao --include-stopped-packages
    sleep 7
done